package com.tzy.rpc.loadbalancer;/**
 * @description:
 * @Author HP
 * @create 2022/3/18 20:41
 */

import com.alibaba.nacos.api.naming.pojo.Instance;

import java.util.List;
import java.util.Random;

/**
 * @author HP
 * @create 2022-03-18 20:41
 * @desc 随机算法
 **/
public class RandomLoadBalancer implements LoadBalancer{
    @Override
    public Instance select(List<Instance> instances) {
        return instances.get(new Random().nextInt(instances.size()));
    }
}
